
<?php $this->load->view('header');?>
<style>
.uimg{
	width:45px;
	height:45px;
	border-radius: 100%;
}
</style>
<body class="childrenBody" style="background: #f2f4f8">
	<div class="row">
		<div class="label1">
			<div class="overview_msg">
				<h5>今日营收</h5> 
				<p class="count"><small>¥ </small><?=$day_total?></p> 
				<p class="tips">本月营收&emsp;¥<?=$month_total?></p>
			</div>
		</div>
		<div class="label2">
			<div class="overview_msg">
				<h5>今日会员</h5> 
				<p class="count"><?=$duser_num?></p> 
				<p class="tips">本月会员&emsp;<?=$muser_num?></p>
			</div>
			
		</div>
		<div class="label3">
			<div class="overview_msg">
				<h5>今日预约</h5> 
				<p class="count"><?=$appoint_num?></p> 
				<p class="tips">预约率&emsp;<?=$app_percen?></p>
			</div>
		</div>
	</div>

	<div class="row2">
		<div class="label4">
			<blockquote class="layui-elem-quote title">快捷入口<i class="iconfont icon-new1"></i></blockquote>
			<div class="quick">
				<ul>
					<li>
						<a class="report_btn">
							<p>
								<i class="layui-icon">&#xe605;</i>
								<span>会员签到</span>
							</p>
						</a>
					</li>
					<li>
						<a class="coach_btn">
							<p>
								<i class="layui-icon">&#xe612;</i>
								<span>添加教练</span>
							</p>
						</a>
					</li>
					<li>
						<a class="notice_btn">
							<i class="layui-icon">&#xe645;</i>
							<span>发布公告</span>
						</a>
					</li>
				</ul>
			</div>

		</div>
		<div class="label6">
			<blockquote class="layui-elem-quote title">最新公告<i class="iconfont icon-new1"></i></blockquote>
			<div class="hnotice">
				<ul id="_notice"></ul>
			</div>
		</div>

	</div>

		<div class="label9">
			<blockquote class="layui-elem-quote title">最新购卡<i class="iconfont icon-new1"></i></blockquote>
			<ul id="_card"></ul>
		</div>

<!-- 	<div class="row3">
		<div class="label7">
			<div class="layui-tab layui-tab-brief" lay-filter="docDemoTabBrief">
			  <ul class="layui-tab-title">
			    <li class="layui-this">今日团课</li>
			    <li>今日私教</li>
			  </ul>
			  <div class="layui-tab-content" style="height: 100px;">
			    <div class="layui-tab-item layui-show">内容不一样是要有，因为你可以监听tab事件（阅读下文档就是了）</div>
			    <div class="layui-tab-item">内容2</div>
			  </div>
			</div> 
		</div>
		<div class="label8">
			<blockquote class="layui-elem-quote title">我的课程<i class="iconfont icon-new1"></i></blockquote>
			
		</div>
		<div class="label9">
			<blockquote class="layui-elem-quote title">最新办卡<i class="iconfont icon-new1"></i></blockquote>
			
		</div>
	</div> -->

	<!-- 模板 -->
	<script id="demo" type="text/html">
	    {{#  layui.each(d.list, function(index, item){ }}
		<li>
			<div class="h_img">
				{{#  if(item.headimg){ }}
				<img src="{{ item.headimg }}" alt="" class="uimg">
				{{# }else{ }}
				<img src="images/default_head.png" alt="" class="uimg">
				{{#  } }}
			</div>
			<div class="h_title">
				<p class="h_course">{{ item.card_name }}</p>
				<p class="h_num">{{ item.total_num }}次</p>
			</div>
			<div class="hcade">
				<p class="hcardt">次卡类型</p>
				<p class="hdate">{{ item.addtime }}</p>
			</div>
		</li>
	    {{#  }); }}

	    {{#  if(d.list.length === 0){ }}
	      暂无数据！
	    {{#  } }} 
	</script>

	<script id="demo2" type="text/html">
	    {{#  layui.each(d.list, function(index, item){ }}
		<li>
			<a id="examine{{item.id}}">
				<p class="hntitle">{{ item.notice_title }}</p>   
				<p class="hndate">{{ item.addtime }}</p>
			</a>
		</li>
	    {{#  }); }}

	    {{#  if(d.list.length === 0){ }}
	      暂无数据！
	    {{#  } }} 
	</script>

	<script type="text/javascript">
		layui.config({
				version: true
			}).use(['layer','flow','laytpl','laydate', 'element'], function(){
				var layer = parent.layer === undefined ? layui.layer : parent.layer,
					laytpl = layui.laytpl,
					flow = layui.flow,
					laydate = layui.laydate,
					element = layui.element,
					$ = layui.jquery;

					//获取最新办卡
					$.get('admin.php/Home/get_new_card', function(data) 
					{
						var getTpl = demo.innerHTML;
						laytpl(getTpl).render(data, function(html){
						  $('#_card').html(html);
						});	

					},'json');

					//获取公告
					$.get('admin.php/Home/notice_list', function(data) 
					{
						var getTpl = demo2.innerHTML;
						laytpl(getTpl).render(data, function(html){
						  $('#_notice').html(html);
						});	

						layui.each(data.list, function(index, el) 
						{
							$('#examine'+el.id).click(function(event) 
							{
							    //示范一个公告层
							    layer.open({
							        type: 1
							        ,title: false //不显示标题栏
							        ,closeBtn: false
							        ,offset: '150px'
							        ,area: '300px;'
							        ,shade: 0.8
							        ,id: 'LAY_layuipro' //设定一个id，防止重复弹出
							        ,btn: ['关闭']
							        ,btnAlign: 'c'
							        ,moveType: 1 //拖拽模式，0或者1
							        ,shade: [0.8, '#f2f2f2']
							        ,content: '<div style="padding: 50px; line-height: 22px; background-color: #393D49; color: #fff; font-weight: 300;">'+el.content+'</div>'
							       
							    });
							});
						});

					},'json');


					//会员签到
					$('.report_btn').click(function(event) 
					{
				        var index = layui.layer.open({
							title : "添加签到",
							type : 2,
							content : "admin.php/Report/add_appoint",
							cancel: function(index, layero){ 
									location.reload();						 
							}  
						})

						//改变窗口大小时，重置弹窗的高度，防止超出可视区域
						$(window).resize(function(){
							layui.layer.full(index);
						})
						layui.layer.full(index);
					});

					//添加教练
					$('.coach_btn').click(function(event) 
					{
				        var index = layui.layer.open({
							title : "添加教练",
							type : 2,
							content : "admin.php/Coach/coach_info",
							cancel: function(index, layero){ 
									location.reload();						 
							}  
						})

						//改变窗口大小时，重置弹窗的高度，防止超出可视区域
						$(window).resize(function(){
							layui.layer.full(index);
						})
						layui.layer.full(index);
					});


					//发布公告
					$('.notice_btn').click(function(event) 
					{
				        var index = layui.layer.open({
							title : "发布公告",
							type : 2,
							content : "admin.php/Home/add_notice",
							cancel: function(index, layero){ 
									location.reload();						 
							}  
						})

						//改变窗口大小时，重置弹窗的高度，防止超出可视区域
						$(window).resize(function(){
							layui.layer.full(index);
						})
						layui.layer.full(index);
					});
			});
	</script>	


</body>
</html>